<?php

namespace common\widgets\colorpicker;

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\widgets\InputWidget;

/**
 * ColorPickerInput
 *
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class ColorPickerInput extends InputWidget {

    /**
     * @inheritdoc
     */
    public function run() {
        $this->registerAssets();
        $this->options['data-field'] = 'colorpicker';
        echo $this->renderInput();
    }

    /**
     * Renders the date picker widget.
     */
    protected function renderInput() {
        return $this->renderInputHtml('text');
    }

    /**
     * Registers the needed assets
     */
    public function registerAssets() {
        $view = $this->getView();
        ColorPickerAsset::register($view);
    }

}
